
<meta charset="utf-8">
<div class="box" id="biz_pmpProject_conatainer">
	<div class="box-header with-border">
		<form id="searchForm" role="form" class="form-inline">
			<div class="form-group">
				<label>项目经理</label> <input name="name" v-model="pmpproject.name"
					type="text" placeholder="" class="form-control">
			</div>
			<div class="form-group">
				<label for="pmUserId"> 开发人员</label> <select type="text"
					name="pmUserId" v-model="searchForm.pmUserId"
					v-kselect="{url:'/pmp/service/ma/pmpCloudMember/loadCloudMemberComboboVo',vmodel:'searchForm.pmUserId',firstEmpty:'true'}"
					class="form-control" id="pmUserId">
				</select>
			</div>
			<div class="form-group">
				<label for="pmUserId">测试人员</label> <select type="text"
					name="pmUserId" v-model="searchForm.pmUserId"
					v-kselect="{url:'/pmp/service/ma/pmpCloudMember/loadCloudMemberComboboVo',vmodel:'searchForm.pmUserId',firstEmpty:'true'}"
					class="form-control" id="pmUserId">
				</select>
			</div>
			<button type="button" class="btn btn-info pull-right m-t-n-xs"
				v-on:click="search">
				<strong>查询</strong>
			</button>
		</form>
	</div>
	<div class="box-body">
		<div class="row">
			<div class="col-md-12">
				<div class="btn-group " id="pmpProjectTableToolbar" role="group">
					<button type="button" v-kperms="{perm:''}" class="btn btn-default"
						v-on:click="add">
						<i class="glyphicon glyphicon-plus" aria-hidden="true"></i> 添加成员
					</button>

					<button type="button" v-kperms="{perm:''}" class="btn btn-default"
						v-on:click="edit">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 修改
					</button>
					<button type="button" v-kperms="{perm:''}" class="btn btn-default"
						v-on:click="deletex">
						<i class="glyphicon glyphicon-trash" aria-hidden="true"></i> 删除成员
					</button>
				</div>
				<form id="pmpProjectMember" role="form" class="form-inline">
					<div class="form-group">
						<label>项目经理</label> <input name="name" v-model="pmpproject.name"
							type="text" placeholder="" class="form-control">
					</div>
					<div class="form-group">
						<label for="pmUserId"> 开发人员</label> <select type="text"
							name="pmUserId" v-model="searchForm.pmUserId"
							v-kselect="{url:'/pmp/service/ma/pmpCloudMember/loadCloudMemberComboboVo',vmodel:'searchForm.pmUserId',firstEmpty:'true'}"
							class="form-control" id="pmUserId">
						</select>
					</div>
					<div class="form-group">
						<label for="pmUserId">测试人员</label> <select type="text"
							name="pmUserId" v-model="searchForm.pmUserId"
							v-kselect="{url:'/pmp/service/ma/pmpCloudMember/loadCloudMemberComboboVo',vmodel:'searchForm.pmUserId',firstEmpty:'true'}"
							class="form-control" id="pmUserId">
						</select>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<script>
new Vue({  
	  el: '#biz_pmpProject_conatainer',
	  data:{
		  searchForm:{
			  name: null,
			  pmUserId: null
		 },
		  bus:new Vue(),
	  },
	  mounted:function(){
		  var _this=this;
			 //_this.bus.$on(zfesVueDirective.getKselectOnInitEventName("pmUserId"), function (msg) {
			// var param=zfesLayerEditDg.getLayerParam();//roleId
		//	_this.searchForm.pmUserId=param.pmUserId;
		    
				//});
		_this.initTable();
	  },
    methods: {
  	  initTable:function(){
  		var _this=this;
  		  var columns=[
  					{checkbox:true},
  					{field:'name',title:'项目名称',width:160,sortable:true},
  					{field:'version_name',title:'项目版本',width:100},
  	                {field:'org_name',title:'所属部门',width:100},
                    {field:'pm_user_name',title:'负责人',width:60},
					{field:'detail',title:'项目详情',width:100},
					{field:'member_count',title:'项目组成员数',width:100},
					{field:'status',title:'当前状态',width:100,formatter:_this.formatStatus}]; 
  		  var url="/pmp/service/ma/pmpProject/loadPmpProjectDataSet";
    		zfesBstable.laodTable($("#pmpProjectBootstrapTable"),$("#searchForm"),$("#pmpProjectTableToolbar"),url,columns,this.searchForm);
  	  },
  	  search:function(){
  		  zfesBstable.reload($("#pmpProjectBootstrapTable")); 
  	  },
  	  refresh:function(){
  		  zfesBstable.refresh($("#pmpProjectBootstrapTable"));
  	  },
  	  add:function(){
  		  var　_this=this;
  		 var url="/views/pmpProject/pmpProject.add.html";
  		 zfesLayerEditDg.open(url,{},"创建项目",660,function(){_this.refresh();});
  		 
  	  },
  	  edit:function(){
  		  if(zfesBstable.isOneRow($("#pmpProjectBootstrapTable"))){
  			  var　_this=this;
  			  var id=zfesBstable.getRowId($("#pmpProjectBootstrapTable"));
  			  var url="/views/pmpProject/pmpProject.edit.html";
  			  zfesLayerEditDg.open(url,{"userId":id},"项目信息编辑",600,function(){_this.refresh();}); 
  		 }
  	  },
  	 projectGroup:function(){
 		  if(zfesBstable.isOneRow($("#pmpProjectBootstrapTable"))){
 			  var　_this=this;
 			  var id=zfesBstable.getRowId($("#pmpProjectBootstrapTable"));
 			  var url="/views/pmpProject/pmpProjectGroup.html";
 			  zfesLayerEditDg.open(url,{"projectId":id},"项目组成员",600,function(){_this.refresh();}); 
 		 }
 	  },
  	  deletex:function(){
  			if(zfesBstable.isSelectedRow($("#pmpProjectBootstrapTable"))){
  				  var　_this=this;
  				    var id=zfesBstable.getRowId($("#cloudMemberBootstrapTable"));
  					//var ids=zfesBstable.getRowIds($("#cloudMemberBootstrapTable"));
  					 alertSwal.confirm("删除","是否删除该项目",function(){
  						    var ajaxUrl = "/pmp/service/ma/pmpProject/deletePmpProject";
  							zfesAjax.ajaxTodo(ajaxUrl, { "id" : id}, function(data) {
  								alertSwal.successText(data.message);
  								_this.refresh();
  							}); 
  				});
  			}
  				
  	  },
  	  formatStatus:function(value, row, index){
  		if("0"==value){return '[未开始]';}else if("1"==value){return '[进行中]';}else if("2"==value){return '[已结束]';}else if("3"==value){return '[暂停中]';}else{return '[已删除]';}
  	}
   	
   }

});
</script>


